#ifndef _houghTransform_KERNEL_H_
#define _houghTransform_KERNEL_H_

typedef struct pt
{
   int x, y;
}MyPoint;

#define pi 3.14159265

#define edge_pixels 50000

#define BLOCK_SIZE 512


__global__ void houghTransform(MyPoint * edgePixels, int * accumulator, int * d_value)
{	
	//float rho, theta;
	
	int i = blockIdx.x * blockDim.x + threadIdx.x;

	for (int index = 0; index < 360*edge_pixels; index++)
	{
		int j = (int)(fabs(((float)edgePixels[i].x * cos((float)index*(pi/180.0))) + ((float)edgePixels[i].y * sin((float)index*(pi/180.0)))))+1;
		//if(j > 0 && j < edge_pixels)
		//{
			atomicAdd(&accumulator[index*edge_pixels + j], 1);
			//accumulator[index*edge_pixels + j]++;
		//}
	}		
	
	__syncthreads();	
}

#endif
